package com.jf3q.admin.controller;

import com.jf3q.admin.service.EduSubjectService;
import com.jf3q.common.vo.ResultVo;
import com.jf3q.common.vo.SubjectVo;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author:xiaojie
 * @create: 2023-05-02 15:24
 * @Description:课程分类接口
 */

@RestController
@RequestMapping("/subject")

public class SubjectController {

    @Resource
    EduSubjectService eduSubjectService;

    @PostMapping("/add")
    @Operation(summary = "导入课程分类的Excel")
    public ResultVo importExcel(MultipartFile file){
       eduSubjectService.importExcel(file);
       return ResultVo.success("导入课程分类成功",null);

    }

    @GetMapping("/all")
    @Operation(summary = "树形显示课程分类列表")
    public ResultVo getAllSubject(){
       List<SubjectVo> subjects= eduSubjectService.getAllSubject();

        return ResultVo.success("查看分类列表",subjects);
    }
}
